//
//  SISSSaleRentPriceOnImageView.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/10/17.
//  Copyright © 2018年 优房网. All rights reserved.
//

#import "SISSSaleRentPriceOnImageView.h"
#import <SDWebImage/UIImageView+WebCache.h>

@interface SISSSaleRentPriceOnImageView ()

@property (weak, nonatomic) UIImageView *imageView;
@property (weak, nonatomic) UILabel *titleLabel;
@property (weak, nonatomic) UILabel *sellTitleLabel;
@property (weak, nonatomic) UILabel *sellPriceLabel;
/// midLineView
@property (weak, nonatomic) UIView *midLineView;
@property (weak, nonatomic) UILabel *rentTitleLabel;
@property (weak, nonatomic) UILabel *rentPriceLabel;
/// bottomLabel
@property (weak, nonatomic) UILabel *bottomLabel;

@end
@implementation SISSSaleRentPriceOnImageView

- (void)setPagePic:(NSString *)pagePic {
    _pagePic = pagePic;
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:pagePic] placeholderImage:[UIImage imageNamed:@"矩形-4"]];
}

- (void)setCommunityName:(NSString *)communityName {
    _communityName = communityName;
    self.titleLabel.text = communityName;
}

- (void)setAverageSellPrice:(NSString *)averageSellPrice {
    _averageSellPrice = averageSellPrice;
    self.sellPriceLabel.text = averageSellPrice;
}

- (void)setAverageRentPrice:(NSString *)averageRentPrice {
    _averageRentPrice = averageRentPrice;
    self.rentPriceLabel.text = averageRentPrice;
}

- (void)setPageDescription:(NSString *)pageDescription {
    _pageDescription = pageDescription;
    self.bottomLabel.text = pageDescription;
}

- (void)initUI {
    [super initUI];
    
    UIImageView *imageView = [[UIImageView alloc] init];
    imageView.image = [UIImage imageNamed:@"矩形-4"];
    [self addSubview:imageView];
    self.imageView = imageView;
    
    UILabel *titleLabel = [UILabel yyr_labelWithText:@"龍威花園" fontSize:44 textColor:UIColor.whiteColor];
    [imageView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
//    UILabel *sellTitleLabel = [UILabel yyr_labelWithText:@"售价（参考均价）" fontSize:15 textColor:UIColor.whiteColor];
//    [self addSubview:sellTitleLabel];
//    self.sellTitleLabel = sellTitleLabel;
//
//    UILabel *sellPriceLabel = [UILabel yyr_labelWithText:@"多层:8544元/㎡" fontSize:15 textColor:UIColor.whiteColor];
//    [self addSubview:sellPriceLabel];
//    self.sellPriceLabel = sellPriceLabel;
//
//    UIView *midLineView = [[UIView alloc] init];
//    midLineView.backgroundColor = UIColor.whiteColor;
//    [self addSubview:midLineView];
//    self.midLineView = midLineView;
//
//    UILabel *rentTitleLabel = [UILabel yyr_labelWithText:@"租金（参考均价）" fontSize:15 textColor:UIColor.whiteColor];
//    [self addSubview:rentTitleLabel];
//    self.rentTitleLabel = rentTitleLabel;
//
//    UILabel *rentPriceLabel = [UILabel yyr_labelWithText:@"21元/月/㎡" fontSize:15 textColor:UIColor.whiteColor];
//    [self addSubview:rentPriceLabel];
//    self.rentPriceLabel = rentPriceLabel;
//
//    UILabel *bottomLabel = [UILabel yyr_labelWithText:@"数据及计算模型由新峰评估提供" fontSize:8 textColor:UIColor.whiteColor];
//    [self addSubview:bottomLabel];
//    self.bottomLabel = bottomLabel;
}

- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGFloat margin = 8.0;
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(weakSelf);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.center.equalTo(weakSelf.imageView);
        make.centerX.equalTo(weakSelf.imageView);
        make.centerY.equalTo(weakSelf.imageView).offset(6 * margin);
    }];
    
//    [self.sellTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(weakSelf).multipliedBy(0.5);
//        make.centerY.equalTo(weakSelf).multipliedBy(1.5);
//    }];
//
//    [self.sellPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(weakSelf.sellTitleLabel.mas_bottom).offset(margin);
//        make.centerX.equalTo(weakSelf.sellTitleLabel);
//    }];
//
//    [self.midLineView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(weakSelf);
//        make.width.mas_equalTo(1);
//        make.top.equalTo(weakSelf.titleLabel.mas_bottom).offset(4 * margin);
//        make.bottom.equalTo(weakSelf.bottomLabel.mas_top).offset(-2 * margin);
//    }];
//
//    [self.rentTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(weakSelf).multipliedBy(1.5);
//        make.centerY.equalTo(weakSelf).multipliedBy(1.5);
//    }];
//
//    [self.rentPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(weakSelf.rentTitleLabel.mas_bottom).offset(margin);
//        make.centerX.equalTo(weakSelf.rentTitleLabel);
//    }];
//
//    [self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(weakSelf);
//        make.bottom.equalTo(weakSelf).offset(-1);
//    }];
}

@end
